android: Enable building binder as module
authorBen Hutchings <ben@decadent.org.uk>
Tue, 8 Jul 2025 11:30:55 +0000 (13:30 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 12 Mar 2026 12:28:10 +0000 (13:28 +0100)
Bug-Debian: https://bugs.debian.org/901492

We want to enable use of the Android binder driver to support
Waydroid, but it should not be built-in as that would waste resources
and increase security attack surface on systems that don't need it.

- Change the Makefiles to build the driver as an object with the
  "_linux" suffix (which is what Waydroid expects)
- Change config symbol types to tristate
- Add a module description, because modpost warns about missing
  descriptions

Gbp-Pq: Topic debian
Gbp-Pq: Name android-enable-building-binder-as-module.patch

drivers/android/Kconfig
drivers/android/Makefile
drivers/android/binder.c
drivers/android/binder_alloc.c

index e2e402c9d1759c81591473ad02ab7ad011bc61d0..7e5d76ecd451e5d5d0db4d9952946ed0a86a7aa1 100644 (file)
@@ -2,7 +2,7 @@
 menu "Android"
 
 config ANDROID_BINDER_IPC
-       bool "Android Binder IPC Driver"
+       tristate "Android Binder IPC Driver"
        depends on MMU
        depends on NET
        default n
index e0c650d3898edeefd66c7d04c28bd1d0f49a76c9..eae81bed1fb9d9905d35defdde811343d4aa10fd 100644 (file)
@@ -1,7 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 ccflags-y += -I$(src)                  # needed for trace events
 
-obj-$(CONFIG_ANDROID_BINDERFS)         += binderfs.o
-obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder.o binder_alloc.o binder_netlink.o
-obj-$(CONFIG_ANDROID_BINDER_ALLOC_KUNIT_TEST)  += tests/
+obj-$(CONFIG_ANDROID_BINDER_IPC)       += binder_linux.o
+binder_linux-y := binder.o binder_alloc.o binder_netlink.o
+binder_linux-$(CONFIG_ANDROID_BINDERFS)        += binderfs.o
+binder_linux-$(CONFIG_ANDROID_BINDER_ALLOC_KUNIT_TEST) += tests/
 obj-$(CONFIG_ANDROID_BINDER_IPC_RUST)  += binder/
index 33e4dad0915bb1c79fc76977dfed6b8124710ca8..44ac3e3c96b36b0106b20f2776d7d664312f8fbc 100644 (file)
@@ -7171,3 +7171,6 @@ device_initcall(binder_init);
 
 #define CREATE_TRACE_POINTS
 #include "binder_trace.h"
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Android Binder IPC Driver");
index d5ed64543bbf44e545629752af726d43d157ac6a..62736c768687e45d178284893dd4d6f8ccd50d0d 100644 (file)
@@ -39,7 +39,7 @@ enum {
 };
 static uint32_t binder_alloc_debug_mask = BINDER_DEBUG_USER_ERROR;
 
-module_param_named(debug_mask, binder_alloc_debug_mask,
+module_param_named(alloc_debug_mask, binder_alloc_debug_mask,
                   uint, 0644);
 
 #define binder_alloc_debug(mask, x...) \